package com.hengpeng.itfints.config;

import java.util.Date;

import org.springframework.stereotype.Service;

import com.googlecode.ehcache.annotations.Cacheable;
import com.hengpeng.common.cis.ComponentContextLoader;
import com.hengpeng.common.util.CalendarUtil;

@Service
public class PolarisziTestImpl implements PolarisziTest
{

	@Cacheable(cacheName = "commonPageCache")
	public String getTime(String i)
	{
		String date = CalendarUtil.formatDate(new Date(), CalendarUtil.LONG_DATE_FORMAT);
		System.out.println(i + "===" + date);
		return date;
	}

	public static void main(String[] args)
	{
		final PolarisziTest dao = ComponentContextLoader.getBean(PolarisziTest.class);
		
		String dd = dao.getTime("a");
		System.out.println(dd);
		
		dd = dao.getTime("a");
		System.out.println(dd);
		
		new Thread(new Runnable()
		{
			public void run()
			{
				dao.getTime("a");
			}
		}).start();

		new Thread(new Runnable()
		{
			public void run()
			{
				dao.getTime("a");
			}
		}).start();

		dd = dao.getTime("a");
		System.out.println(dd);
		System.out.println("success===");
	}
}
